/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.faytechcc.csc251.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.util.Scanner;

/**
 *
 * @author Kent
 */
public class SQLExecuter {

    public static void main(String[] args)
            throws Exception {
        final String DB_URL =
                "jdbc:derby:MTGCardDB";

        try {
            //Create a connection to the database.
            Connection conn = DriverManager.getConnection(DB_URL);

            //Create a Statement object
            Statement stmt = conn.createStatement();
            Scanner keyboard = new Scanner(System.in);
            System.out.println("Enter an SQL Statement..");
            String sql = keyboard.nextLine();
            stmt.execute(sql);

            //Close the resources
            stmt.close();
            conn.close();
            System.out.println("Done");
        } catch (Exception ex) {
            System.out.println("ERROR: " + ex.getMessage());
        }
    }
}
